package com.example.alibabanacosdiscoveryclient01.config.ai;

import com.example.alibabanacosdiscoveryclient01.service.BookService;
import com.example.alibabanacosdiscoveryclient01.service.ClimateService;
import org.springframework.ai.tool.ToolCallbackProvider;
import org.springframework.ai.tool.method.MethodToolCallbackProvider;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author:guoq
 * @date:2025/4/29
 * @descripion:
 */
@Configuration
public class McpServerConfig {
    /**
     * @desc: 注册工具回调提供者，BookService中@Tool方法暴露为MCP工具
     * @param bookServiceImpl
     * @return
     */
    @Bean
    public ToolCallbackProvider bookToolCallbackProvider(BookService bookServiceImpl, ClimateService climateService) {
        return MethodToolCallbackProvider.builder()
                .toolObjects(bookServiceImpl,climateService)
                .build();
    }

}
